/**
 * Copyright (c) Enalean, 2016 - 2017. All Rights Reserved.
 *
 * This file is a part of Tuleap.
 *
 * Tuleap is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Tuleap is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tuleap. If not, see <http://www.gnu.org/licenses/>.
 */

@mixin nav-link($max-width) {
    display: flex;
    align-items: center;
    padding: 0 15px;
    transition: color 100ms linear;
    color: $tlp-ui-dimmed;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-decoration: none;
    text-transform: uppercase;
    white-space: nowrap;

    &:hover {
        text-decoration: none;
    }

    > .nav-link-icon {
        display: none;
        font-size: 16px;

        @media screen and (max-width: $max-width) {
            display: inline;
        }
    }

    > .nav-link-icon-dropdown {
        margin: 0 0 0 5px;
    }

    > .nav-link-text {
        @media screen and (max-width: $max-width) {
            display: none;
        }
    }

    &:hover {
        text-decoration: none;
    }
}

.nav-link {
    @include nav-link(900px);

    &.go-to-admin {
        color: $tlp-ui-danger;
    }

    &:hover {
        transition: color 100ms linear;
        color: $tlp-theme-color;
    }
}

// scss-lint:disable VendorPrefix
.nav-dropdown {
    display: flex;
    position: relative;
    cursor: pointer;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-select: none;
    user-select: none;

    &:hover > .nav-dropdown-link {
        transition: color 100ms linear;
        color: $tlp-theme-color;
    }
}

.nav-dropdown-link {
    @include nav-link(900px);
}

.only-icon {
    .nav-link-icon {
        display: inline;
    }

    .nav-link-text {
        display: none;
    }
}

.without-carret > .nav-dropdown-link > .nav-link-icon-dropdown {
    display: none;
}

.nav-form {
    display: flex;
    align-items: center;
    padding: 0 15px;
}

.nav-form-button {
    padding: 0;
    transition: color 100ms linear;
    border: 0;
    background: none;
    color: $tlp-ui-dimmed;
    font-size: 16px;
    letter-spacing: 1px;
    cursor: pointer;

    &:hover {
        transition: color 100ms linear;
        color: $tlp-theme-color;
    }
}

.nav-form-button-icon {
    font-size: 16px;
}

#logo {
    display: inline-block;
    flex: 0 0 auto;
    width: $sidebar-expanded-width;
    height: $navbar-height;
    background: $tlp-theme-color url('../images/organization_logo.png') no-repeat center center;

    + #global-nav {
        margin: 0 0 0 $tlp-half-spacing;
    }
}

#global-nav {
    display: flex;
}

#global-search {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
}

#global-search-input {
    width: 100%;
    min-width: 75px;
}

#user-nav {
    display: flex;
    margin: 0 0 0 $tlp-half-spacing;
    border-left: 1px solid $tlp-ui-border-normal;
    white-space: nowrap;

    > .user-block {
        display: flex;
        align-items: center;
        padding: 0 20px 0 10px;

        > .user-block-names {
            display: flex;
            flex-direction: column;
            margin: 0 0 0 $tlp-half-spacing;
            letter-spacing: normal;
            text-transform: none;

            @media screen and (max-width: 1250px) {
                display: none;
            }

            > .user-nav-display-name {
                margin: 0 0 3px;
                color: $tlp-theme-color;
                font-size: 14px;
                font-weight: 600;
            }

            > .user-nav-username {
                font-size: 12px;
                font-weight: 400;
            }
        }
    }
}

#current-project-nav {
    display: flex;
    align-items: center;
    padding: 0 $tlp-spacing;
    border-right: 1px solid $tlp-ui-border-normal;
}

.current-project-name {
    max-width: 250px;
    overflow: hidden;
    color: $tlp-theme-color;
    font-size: 16px;
    letter-spacing: .5px;
    text-decoration: none;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;

    &:hover {
        text-decoration: none;
    }
}

.current-project-icon {
    margin: 0 5px 0 0;
    color: $tlp-theme-color;
    font-size: 16px;
}

.join-tuleap-community {
    width: 36px;
    height: 100%;
    padding: 0 0 0 $tlp-half-spacing;
    fill: $tlp-theme-color;
}
